class Events:
    COUNT = 2
    ONATTACK, PLAYERMOVE=range(COUNT)
    EVENT_LIST = range(COUNT)
    
class EntityEvents:
    COUNT=2
    ON_CRITICAL_HEALTH, ON_ATTACKED=range(COUNT)
    EVENT_LIST=range(COUNT)

class EventController:
    def __init__(self, eventList = Events.EVENT_LIST):
        self.events = []
        for i in eventList:
            self.events.append([])
    def subscribe(self, event, observerDelegate, paramKey):
        self.events[event].append((observerDelegate, paramKey))
        
    def emitEvent(self, event, paramsDic):
        
        for observer in self.events[event]:
            delegate = observer[0] #either delegate is a bound method or the delegate is a calls that implements __call__ magic method.
            paramKey = observer[1]
            if paramsDic.has_key(paramKey):
                params = paramsDic[paramKey]
                delegate(params)